package org.git.movie.controller;

import org.git.movie.annotations.Verify;
import org.git.movie.form.NewsRecommendForm;
import org.git.movie.service.NewsRecommendService;
import org.git.movie.util.BaseController;
import org.git.movie.util.BaseResponse;
import org.git.movie.vo.NewsRecommendVo;
import org.git.movie.vo.PageDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author sqyc
 */
@RestController
@RequestMapping("")
public class NewsRecommendController  extends BaseController {

    @Autowired
    private NewsRecommendService newsRecommendService;

    @PostMapping("/newsRecommend/dosearch.do")
    public BaseResponse<PageDto<NewsRecommendVo>> dosearch(
            @Verify(param="pageNo",rule="required|min(1)") int pageNo,
            @Verify(param="pageSize",rule="required|min(3)|max(60)") int pageSize,
            NewsRecommendForm newsRecommendForm
    ){

        PageDto<NewsRecommendVo> pages =  newsRecommendService.findPage(newsRecommendForm,pageNo,pageSize);
        return   ok(pages);

    }
}
